﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace LightLog.Model.Input
{

    public class LogInput
    {
        /// <summary>
        /// Examples: "SeriLogInput"
        /// </summary>
        [JsonProperty("_typeTag")]
        public string TypeTag { get; set; }

        /// <summary>
        /// 异常码
        /// Examples: "9718bd0782e5468e9701c8504a68cdaa"
        /// </summary>
        [JsonProperty("ErrorCode")]
        public string ErrorCode { get; set; }

        /// <summary>
        /// 异常信息
        /// Examples: "测试异常"
        /// </summary>
        [JsonProperty("ExceptionInfo")]
        public string ExceptionInfo { get; set; }

        /// <summary>
        /// 异常类型
        /// Examples: "404"
        /// </summary>
        [JsonProperty("ExceptionName")]
        public string ExceptionName { get; set; }

        /// <summary>
        /// 项目代码
        /// Examples: "bestshowapi"
        /// </summary>
        [JsonProperty("ProjectCode")]
        public string ProjectCode { get; set; }

        /// <summary>
        /// 客户端信息
        /// </summary>
        [JsonProperty("ClientSystem")]
        public string ClientSystem { get; set; }

        /// <summary>
        /// 发送者
        /// Examples: "张三"
        /// </summary>
        [JsonProperty("Sender")]
        public string Sender { get; set; }

        /// <summary>
        /// 版本号
        /// Examples: "1.1.1.1"
        /// </summary>
        [JsonProperty("Version")]
        public string Version { get; set; }
    }

    public class Properties
    {
        /// <summary>
        /// 日志时间
        /// Examples: "2023-11-08 20:08:22"
        /// </summary>
        [JsonProperty("DateTimeNow")]
        public string DateTimeNow { get; set; }

        /// <summary>
        /// (可选) 日志自定义格式
        /// Examples: {"ProjectCode":"bestshowapi","ErrorCode":"9718bd0782e5468e9701c8504a68cdaa","Sender":"张三","Version":"1.1.1.1","ExceptionName":"404","ExceptionInfo":"测试异常","_typeTag":"SeriLogInput"}
        /// </summary>
        [JsonProperty("Input")]
        public LogInput Input { get; set; }
    }

    public class SeriLogInput
    {
        /// <summary>
        /// 日志级别
        /// Examples: "Error", "Information"
        /// </summary>
        [JsonProperty("Level")]
        public string Level { get; set; }

        /// <summary>
        /// 消息模版
        /// Examples: "{@input}", "Starting web host"
        /// </summary>
        [JsonProperty("MessageTemplate")]
        public string MessageTemplate { get; set; }

        /// <summary>
        /// 属性
        /// Examples: {"Input":{"ProjectCode":"bestshowapi","ErrorCode":"9718bd0782e5468e9701c8504a68cdaa","Sender":"张三","Version":"1.1.1.1","ExceptionName":"404","ExceptionInfo":"测试异常","_typeTag":"SeriLogInput"},"DateTimeNow":"2023-11-08 20:08:22"}, {"DateTimeNow":"2023-11-08 20:08:22"}
        /// </summary>
        [JsonProperty("Properties")]
        public Properties Properties { get; set; }

        /// <summary>
        /// 消息内容
        /// Examples: "SeriLogInput { ProjectCode: \"bestshowapi\", ErrorCode: \"9718bd0782e5468e9701c8504a68cdaa\", Sender: \"张三\", Version: \"1.1.1.1\",ExceptionName: \"404\", ExceptionInfo: \"测试异常\" }", "Starting web host"
        /// </summary>
        [JsonProperty("RenderedMessage")]
        public string RenderedMessage { get; set; }

        /// <summary>
        /// 日志时间戳
        /// Examples: "2023-11-08T12:08:22.1998888Z", "2023-11-08T12:08:22.2260246Z"
        /// </summary>
        [JsonProperty("Timestamp")]
        public DateTime Timestamp { get; set; }
    }



    /*//请求json
    [{"Timestamp":"2023-11-08T12:08:22.1998888Z","Level":"Error","MessageTemplate":"{@input}","RenderedMessage":"LogInput { ProjectCode: \"bestshowapi\", ErrorCode: \"9718bd0782e5468e9701c8504a68cdaa\", Sender: \"张三\",Version: \"1.1.1.1\",ExceptionName: \"404\", ExceptionInfo: \"测试异常\" }","Properties":{"input":{"ProjectCode":"bestshowapi","ErrorCode":"9718bd0782e5468e9701c8504a68cdaa","Sender":"张三","Version":"1.1.1.1","ExceptionName":"404","ExceptionInfo":"测试异常","_typeTag":"LogInput"},"DateTimeNow":"2023-11-08 20:08:22"}}
       ,{"Timestamp":"2023-11-08T12:08:22.2260246Z","Level":"Information","MessageTemplate":"Starting web host","RenderedMessage":"Starting web host","Properties":{"DateTimeNow":"2023-11-08 20:08:22"}}
       ]
       
     */

}
